/* 
 * File:   Add.cpp
 * Author: Gab'z
 * 
 * Created on 2 mai 2012, 17:21
 */

#include "Add.h"
#include "Nombre.h"

Add::~Add() {
}

const Constante* Add::apply(const Constante* x, const Constante* y) const throw (OperatorException) {
    // on évite les expressions au niveau de OperateurBinaire.h
    const Nombre* nbr1 = dynamic_cast<const Nombre*> (x->clone());
    const Nombre* nbr2 = dynamic_cast<const Nombre*> (y->clone());
    const Constante* res = add(nbr1, nbr2);
    delete nbr1;
    delete nbr2;
    return res;
}